#ifndef MODULE_H_
#define MODULE_H_

/*
Copyright (C) 2011 Salil Bhagurkar

This file is part of illusion

illusion is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

illusion is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with illusion.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <kernel/types.h>

/*
 * Default kernel module information.
 * Currently being used by apimod
 */


struct km_import {
	void (*console_debug)(const char *file, const char *function, uint_t lineno, char *fmt, ...);
};

#define KERNEL_MODULE_SIGN "KERNMOD"

struct kernel_module {
	//Signature
	char sign[8];
	//The below 6 fields are filled in statically by the module itself
	void *header, *load, (*entry)(), *data, *bss, *end;
	//The name of the module
	char name[32];
	//Basic imported functions for module
	struct km_import km_import;
	//The module specific interface
	void *export;
}__attribute__((packed));


int load_apimod(char *path, u32 access_flags);

#endif /* MODULE_H_ */
